﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Tools.File
{
    public class PathEx
    {
        public String fullPath;
        public String fileName;
        public String extension;
        public String directory;
        public PathEx(String path) { 
            this.fullPath = Path.GetFullPath(path);
            this.extension = Path.GetExtension(this.fullPath);
            this.fileName = Path.GetFileNameWithoutExtension(this.fullPath);
            this.directory = Path.GetDirectoryName(this.fullPath);
        }

        override public String ToString() {
            String ret = this.directory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
            ret += this.fileName;
            if (this.extension != "") {
                ret += "." + this.extension.TrimStart('.');
            };

            return ret;
        }
    }
}
